import { Injectable } from '@angular/core';
import { Resolve, Router } from '@angular/router';
import { ApiService } from 'src/app/core/api';
import { StorageService } from '../sotrage/storage.service';

@Injectable()
export class UserInfoActivate implements Resolve<any> {
	constructor(private sto: StorageService,private apiService:ApiService,private router: Router){}
	resolve() {
		return this.apiService.post('用户详情', {}, null, null, null, true).then(res => {
			this.sto.set('userDel',res['data']);
			return res['data'];
		}).catch(res => {
			if (res.status === 403) {
				sessionStorage.setItem('returnurl', '/indexMy');
				this.router.navigateByUrl('/login');
			}
			return res;
		});
	}
}
